package com.yanqu.road.server.cmd.orewar.task;


import com.yanqu.road.pb.orewar.OreWarProto;
import com.yanqu.road.server.cmd.base.BaseTask;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.activity.orewar.OreWarMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

public class OrePitRecallTask extends BaseTask {

	private int activityId;

	private int pitId;

	public int getActivityId() {
		return activityId;
	}

	public OrePitRecallTask(YanQuMessage packet, GamePlayer player) {
		super(packet, player);
	}

	@Override
	protected boolean parseData() throws Exception {
		OreWarProto.OrePitWithdrawReqMsg msg = OreWarProto.OrePitWithdrawReqMsg.parseFrom(packet.getBytes());
		activityId = msg.getActivityId();
		pitId = msg.getPitId();
		return true;
	}

	@Override
	protected void execute() {

	}

	@Override
	protected void sendData(GamePlayer player) {
		OreWarProto.OrePitWithdrawRespMsg.Builder resMsg =  OreWarProto.OrePitWithdrawRespMsg.newBuilder();
		if(ret == 0){
			resMsg = OreWarMgr.orePitRecall(player, activityId, pitId);
		}
		resMsg.setRet(ret);
		player.sendPacket(Protocol.U_ORE_WAR_RECALL_PIT, resMsg);
	}

}
